package com.serial.comm.config;

import com.serial.comm.core.interceptor.IdentityInterceptor;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;

import javax.annotation.Resource;

@Configuration
public class InterceptorConfig extends WebMvcConfigurerAdapter {

    @Resource
    private IdentityInterceptor identityInterceptor;

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(identityInterceptor)
                //过滤这两个 oauth2鉴权接口
                .excludePathPatterns("/oauth/**", "/user/**");
        super.addInterceptors(registry);
    }
}